package com.huluspace.learnhub.dto;

public class ApiResponse<T> {
  public int code;
  public String msg;
  public T data;

  public ApiResponse(int code, String msg, T data) {
    this.code = code;
    this.msg = msg;
    this.data = data;
  }

  public static <T> ApiResponse<T> success(T data) {
    return new ApiResponse<>(0, "成功", data);
  }

  public static <T> ApiResponse<T> error(String msg) {
    return new ApiResponse<>(1, msg, null);
  }
}

